
using System;
using NUnit.Framework;

namespace Universe.Parallel.Test
{
    [TestFixture]
    public class RangeFor_TestDouble
    {

        [Test]
        public void TestBack()
        {
            Util.IsEquals(new Double[] { 5, 4, 3, 2, 1 }, RangeFor<Double>.Back(5, 1), "RangeFor<Double>.Back(5, 1)");
            Util.IsEquals(new Double[] { 1 }, RangeFor<Double>.Back(1, 1), "RangeFor<Double>.Back(1, 1)");
            Util.IsEquals(new Double[] { }, RangeFor<Double>.Back(1, 5), "RangeFor<Double>.Back(1, 5)");
            Util.IsEquals(new Double[] { Double.MaxValue, }, RangeFor<Double>.Back(Double.MaxValue, Double.MaxValue), "RangeFor<Double>.Back(Double.MaxValue, Double.MaxValue)");
            Util.IsEquals(new Double[] { Double.MinValue, }, RangeFor<Double>.Back(Double.MinValue, Double.MinValue), "RangeFor<Double>.Back(Double.MinValue, Double.MinValue)");
        }

        [Test]
        public void TestCreate()
        {
            Util.IsEquals(new Double[] { Double.MinValue + 3, Double.MinValue + 1 }, RangeFor<Double>.Create(Double.MinValue + 3, Double.MinValue, -2), "RangeFor<Double>.Create(Double.MinValue + 3, Double.MinValue, -2)");
            Util.IsEquals(new Double[] { Double.MaxValue - 3, Double.MaxValue - 1 }, RangeFor<Double>.Create(Double.MaxValue - 3, Double.MaxValue, 2), "RangeFor<Double>.Create(Double.MaxValue - 3, Double.MaxValue, 2)");
            Util.IsEquals(new Double[] { 1 }, RangeFor<Double>.Create(1, 2, 3), "RangeFor<Double>.Create(1, 2, 3)");
            Util.IsEquals(new Double[] { }, RangeFor<Double>.Create(Double.MaxValue, Double.MinValue, 1), "RangeFor<Double>.Create(Double.MaxValue, Double.MinValue, 1)");
            Util.IsEquals(new Double[] { }, RangeFor<Double>.Create(Double.MinValue, Double.MaxValue, -1), "RangeFor<Double>.Create(Double.MinValue, Double.MaxValue, -1)");
            Util.IsEquals(new Double[] { Double.MaxValue }, RangeFor<Double>.Create(Double.MaxValue, Double.MaxValue, 1), "RangeFor<Double>.Create(Double.MaxValue, Double.MaxValue, 1)");
            Util.IsEquals(new Double[] { Double.MinValue }, RangeFor<Double>.Create(Double.MinValue, Double.MinValue, -1), "RangeFor<Double>.Create(Double.MinValue, Double.MinValue, -1)");
        }

        [Test]
        public void TestForward()
        {
            Util.IsEquals(new Double[] { 1 }, RangeFor<Double>.Forward(1, 1), "RangeFor<Double>.Forward(1, 1)");
            Util.IsEquals(new Double[] { 1, 2, 3, 4, 5 }, RangeFor<Double>.Forward(1, 5), "RangeFor<Double>.Forward(1, 5)");
            Util.IsEquals(new Double[] { }, RangeFor<Double>.Forward(5, 1), "RangeFor<Double>.Forward(5, 1)");
            Util.IsEquals(new Double[] { Double.MaxValue }, RangeFor<Double>.Forward(Double.MaxValue, Double.MaxValue), "RangeFor<Double>.Forward(Double.MaxValue, Double.MaxValue)");
            Util.IsEquals(new Double[] { Double.MinValue }, RangeFor<Double>.Forward(Double.MinValue, Double.MinValue), "RangeFor<Double>.Forward(Double.MinValue, Double.MinValue)");
        }

    }
}

